package com.zhledu.collegename;

import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Mapper;

import java.io.IOException;

public class CollegeNameMapper extends Mapper<LongWritable, Text, Text, Text> {
    @Override
    protected void map(LongWritable key, Text value, Mapper<LongWritable, Text, Text, Text>.Context context) throws IOException, InterruptedException {
        //某一行数据
        String departName = value.toString().split(",")[4].split(":")[1].replace("'", "");
        String schoolName = value.toString().split(",")[2].split(":")[1].replace("'", "");
        context.write(new Text(departName), new Text(schoolName));
    }
}
